/*
\ * 文件名：JobWantedController.java	 
 * 时     间：下午4:20:10
 * 作     者：liyf       
 * 版     权： 2014-2022  智慧园区, 公司保留所有权利.
 * 联     系：www.szyungu.com
 */
package com.cz073586.technology.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.cz073586.common.contants.CommonContans;
import com.cz073586.common.controller.BaseController;
import com.cz073586.common.entity.pojo.PageInfo;
import com.cz073586.technology.model.JobWanted;
import com.cz073586.technology.service.face.JobWantedService;
import com.cz073586.tools.privilege.ResourceAndOperate;
import com.cz073586.tools.util.UUIDGenerateUtil;

/**
 * @ClassName: JobWantedController
 * @Description: 这里用一句话描述这个类的作用
 * @author zengqj
 * @date 2015年1月20日 下午4:20:10
 */
@RestController
@RequestMapping(value = "/JobWanted", method = RequestMethod.POST)
@ResourceAndOperate(
		moduleID = "com.technology.JobWanted", 
		moduleName = "求职管理", 
		resouceDesc = "求职管理",
		parentModuleID = "com.technology", 
		parentModuleName = "昱显科技项目"
		)
public class JobWantedController extends BaseController
{
	@Autowired
	private JobWantedService jobWantedService;
	
	/**
	 * 
	 * @方法名称: queryServicesByPage
	 * @描述: 查询求职列表
	 *
	 * @参数:
	 * @param page
	 * @return
	 *
	 * @返回类型: ModelMap
	 * @作者:zengqj
	 * @可能抛出异常:
	 */
	@RequestMapping(value = "/queryJobWantedByPage.action", consumes = "application/json", produces = "application/json")
	@ResponseBody
	@ResourceAndOperate(
			moduleID = "com.technology.JobWanted.queryJobWantedByPage", 
			moduleName = "通过分页对象查询", 
			resouceDesc = "查询分页",
			parentModuleID = "com.technology.JobWanted", 
			parentModuleName = "求职管理"
			)
	public ModelMap queryJobWantedByPage(@RequestBody JobWanted jobWanted)
	{
		ModelMap resultMap = new ModelMap();
		
		try
		{
			resultMap.put(CommonContans.STRUTS_DATA, jobWantedService.queryByObject(jobWanted));
			resultMap.put(CommonContans.STRUTS_RESULT,
					CommonContans.STRUTS_SUCCESS);
		} catch (Throwable e)
		{
			// 请保持所有代码一直性，没有特殊处理请使用该代码.
			this.printExction(resultMap, e);
		}
		return resultMap;
	}
	
	/**
	 * 
	 * @方法名称: queryJobWantedById
	 * @描述: 通过求职ID查询
	 *
	 * @参数:
	 * @param JobWantedId
	 * @return
	 *
	 * @返回类型: ModelMap
	 * @作者:zengqj
	 * @可能抛出异常:
	 */
	@RequestMapping(value = "/queryJobWantedById.action", consumes = "application/json", produces = "application/json")
	@ResponseBody
	@ResourceAndOperate(
			moduleID = "com.technology.JobWanted.queryJobWantedById", 
			moduleName = "查询单一求职", 
			resouceDesc = "通过ID查询求职",
			parentModuleID = "com.technology.JobWanted", 
			parentModuleName = "求职管理"
			)
	public ModelMap queryJobWantedById(String JobWantedId)
	{
		ModelMap resultMap = new ModelMap();
		
		try
		{
			
			resultMap.put(CommonContans.STRUTS_DATA,
					jobWantedService.selectByPrimaryKey(JobWantedId));
			resultMap.put(CommonContans.STRUTS_RESULT,
					CommonContans.STRUTS_SUCCESS);
		} catch (Throwable e)
		{
			// 请保持所有代码一直性，没有特殊处理请使用该代码.
			this.printExction(resultMap, e);
		}
		return resultMap;
	}
	
	/**
	 * 
	 * 方法描述：添加求职信息，uuid由代码写入
	 * 
	 * @Title: insertJobWanted
	 * @param @param JobWanted
	 * @param @return
	 * @return ModelMap
	 * @JobWanted Administrator 2015年1月21日
	 * @throws
	 */
	@RequestMapping(value = "/insertJobWanted.action", consumes = "application/json", produces = "application/json")
	@ResponseBody
	@ResourceAndOperate(
			moduleID = "com.technology.JobWanted.insertJobWanted", 
			moduleName = "添加", 
			resouceDesc = "添加求职",
			parentModuleID = "com.technology.JobWanted", 
			parentModuleName = "求职管理"
			)
	public ModelMap insertJobWanted(@RequestBody JobWanted JobWanted)
	{
		ModelMap resultMap = new ModelMap();
		
		try
		{
			JobWanted.setUuid(UUIDGenerateUtil.generate());
			resultMap.put(CommonContans.STRUTS_DATA,
					jobWantedService.insert(JobWanted));
			resultMap.put(CommonContans.STRUTS_RESULT,
					CommonContans.STRUTS_SUCCESS);
		} catch (Throwable e)
		{
			// 请保持所有代码一直性，没有特殊处理请使用该代码.
			this.printExction(resultMap, e);
		}
		return resultMap;
	}
	
	/**
	 * 
	 * 方法描述：根据JobWanted主机修改求职信息
	 * 
	 * @Title: updateJobWanted
	 * @param @param JobWanted
	 * @param @return
	 * @return ModelMap
	 * @JobWanted Administrator 2015年1月21日
	 * @throws
	 */
	@RequestMapping(value = "/updateJobWanted.action", consumes = "application/json", produces = "application/json")
	@ResponseBody
	@ResourceAndOperate(
			moduleID = "com.technology.JobWanted.updateJobWanted", 
			moduleName = "修改", 
			resouceDesc = "修改",
			parentModuleID = "com.technology.JobWanted", 
			parentModuleName = "求职管理"
			)
	public ModelMap updateJobWanted(@RequestBody JobWanted JobWanted)
	{
		ModelMap resultMap = new ModelMap();
		
		try
		{
			resultMap.put(CommonContans.STRUTS_DATA,
					jobWantedService.updateByPrimaryKeySelective(JobWanted));
			resultMap.put(CommonContans.STRUTS_RESULT,
					CommonContans.STRUTS_SUCCESS);
		} catch (Throwable e)
		{
			// 请保持所有代码一直性，没有特殊处理请使用该代码.
			this.printExction(resultMap, e);
		}
		return resultMap;
	}
	
	/**
	 * 
	 * 方法描述：根据主键删除求职
	 * 
	 * @Title: deleteJobWanted
	 * @param @param JobWantedId
	 * @param @return
	 * @return ModelMap
	 * @JobWanted Administrator 2015年1月21日
	 * @throws
	 */
	@RequestMapping(value = "/deleteJobWanted.action", consumes = "application/json", produces = "application/json")
	@ResponseBody
	@ResourceAndOperate(
			moduleID = "com.technology.JobWanted.deleteJobWanted", 
			moduleName = "删除", 
			resouceDesc = "删除",
			parentModuleID = "com.technology.JobWanted", 
			parentModuleName = "求职管理"
			)
	public ModelMap deleteJobWanted(String JobWantedId)
	{
		ModelMap resultMap = new ModelMap();
		
		try
		{
			resultMap.put(CommonContans.STRUTS_DATA,
					jobWantedService.deleteByPrimaryKey(JobWantedId));
			resultMap.put(CommonContans.STRUTS_RESULT,
					CommonContans.STRUTS_SUCCESS);
		} catch (Throwable e)
		{
			// 请保持所有代码一直性，没有特殊处理请使用该代码.
			this.printExction(resultMap, e);
		}
		return resultMap;
	}
}
